package com.t249.bdqn.renting.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.t249.bdqn.renting.entity.RetCollection;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
@Mapper
public interface RetCollectionDao extends BaseMapper<RetCollection> {

    @Select("SELECT * FROM `ret_collection` r,`ret_rental_information` zhu WHERE r.`rental_Id` = zhu.`ret_id` AND r.`ret_state` = 0 AND r.`user_Id` = #{userId}")
    public List<Map<String,Object>> souchang(String userId);

    @Update("UPDATE `renting`.`ret_collection` SET `ret_state` = #{retState} WHERE `id` = #{id}")
    public int xuigaiZuantai(@Param("retState")Integer retState,@Param("id")Integer id);

}
